package WaiBao;

import java.util.Arrays;

public class XiaChenYu {
    public static void main(String[] args) {
        String[] name = {"李勋(班长)", "张志发(副班长)", "小李(学习委员)", "理发话(纪律委员)", "小琦", "小道", "小建", "小万", "小艺", "小妹", "小刚", "小紫",
                "小科", "小旭", "小明", "小为", "小委", "小照", "小可", "小进", "小源", "小贞", "小云", "小峰", "小答", "小金", "小文", "小松",
                "小叶", "夏晨瑀(学生)"};//考生本人:夏晨瑀(学生)
        int[] age = {19, 22, 20, 18, 20, 20, 19, 20, 20, 18, 18, 20, 21, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 20, 20, 20, 21, 19};//考生本人年龄:19


        double[] ceng1 = {75, 60, 86, 91, 90, 74, 78, 85, 81, 91, 91, 87, 84, 79, 65, 64, 89, 95, 86, 88, 92, 91, 95, 65, 75, 74, 92, 84, 84, 97};
        double[] ceng2 = {86, 77, 65, 76, 85, 67, 67, 64, 73, 84, 92, 77, 66, 84, 85, 65, 76, 69, 76, 98, 72, 71, 95, 86, 75, 88, 84, 64, 81, 95};
        double[] ceng3 = {69, 61, 84, 85, 75, 64, 78, 69, 80, 80, 93, 87, 85, 65, 65, 68, 69, 66, 96, 93, 92, 81, 65, 95, 76, 84, 73, 71, 84, 95};


        double fu1 ;//代表每个学生的总分
        double fu2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            fu1  = ceng1[i] + ceng2[i] + ceng3[i];
//            fu2 = (fu1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + fu1);
//            System.out.println(name[i] + "的平均分为:" + fu2);
//        }

        double huhu1 = 0, huhu2 = 0;
        double[] gg = new double[30];
//        for (int i = 0; i < 30; i++) {
//            huhu1=ceng1[i] + ceng2[i] + ceng3[i];
//            huhu2 = (huhu1* 1.0) / 3;
//            gg[i] = huhu2;
//        }
//
//        for (int i = 0; i < gg.length - 1; i++) {
//            for (int j = 0; j < gg.length - i - 1; j++) {
//                if (gg[j] <gg[j + 1]) {
//                    double tep = gg[j];
//                    gg[j] = gg[j + 1];
//                    gg[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println( gg[i]);
//        }



        double gequ1 = 0, gequ2 = 0,gequ3 = 0;//计算每门课的平均分
        double dada1 = 0, dada2 = 0, dada3 = 0;//计算每门课标准差
        double tear1 = 0, tear2 = 0, tear3 = 0;//计算每门课中位数
        double he = 0;
        for (int i = 0; i < ceng1.length; i++) {
            he +=ceng1[i];
        }
        gequ1 = (he * 1.0) / 30;
        System.out.println("农业设施及环境调控的班级平均分为:" + gequ1);
        double Sum = 0;
        for (int i = 0; i < ceng2.length; i++) {
            Sum +=ceng2[i];
        }
        gequ2 = (Sum * 1.0) / 30;
        System.out.println("农业设施设计与建造的班级平均分为:" + gequ2);
        double sum = 0;
        for (int i = 0; i <ceng3.length; i++) {
            sum +=ceng3[i];
        }
        gequ3 = (sum * 1.0) / 30;
        System.out.println("园艺植物设施栽培学的班级平均分为:" + gequ3);



        double c1 = 0, c2 = 0, c3 = 0;
        for (int i = 0; i <ceng1.length; i++) {
            c1 += (ceng1[i] - gequ1) * (ceng1[i] - gequ1);
        }
        dada1 = Math.sqrt(c1*1.0/30);
        System.out.println("农业设施及环境调控的班级标准差为:" + dada1);
        for (int i = 0; i < ceng2.length; i++) {
            c2 += (ceng2[i] - gequ2) * (ceng2[i] -gequ2);
        }
        dada2 = Math.sqrt(c2*1.0/30);
        System.out.println("农业设施设计与建造的班级标准差为:" +dada2);

        for (int i = 0; i <ceng3.length; i++) {
            c3 += (ceng3[i] -gequ3) * (ceng3[i] -  gequ3);
        }
        dada3 = Math.sqrt(c3*1.0/30);
        System.out.println("园艺植物设施栽培学的标准差为:" + dada3);
//////////
        Arrays.sort(ceng1);
        Arrays.sort(ceng2);
        Arrays.sort(ceng3);
        tear1 = (ceng1[15] +ceng2[14]) * 1.0 / 2;
        tear2 = (ceng2[15] +ceng2[14]) * 1.0 / 2;
        tear3 = (ceng3[15] +ceng3[14]) * 1.0 / 2;
        System.out.println("农业设施及环境调控的中位数为:" + tear1);
        System.out.println("农业设施设计与制造的中位数为:" + tear2);
        System.out.println("园艺植物设施栽培学的中位数为:" + tear3);






    }
}
